import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/table';
import { RenderType } from '@pkg/setting';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';

export const columns: BasicColumn[] = [
  {
    title: '会员姓名',
    dataIndex: 'userName',
    width: 80,
  },
  {
    title: '手机号',
    dataIndex: 'userPhone',
    width: 100,
  },
  {
    title: '退卡卡号',
    dataIndex: 'vipcardNo',
    width: 140,
  },
  {
    title: '退款日期',
    dataIndex: 'refundDate',
    width: 150,
  },
  {
    title: '退款金额',
    dataIndex: 'refundAmount',
    width: 100,
  },
  {
    title: '退卡工单状态',
    dataIndex: 'refundState',
    width: 150,
    customRender: ({ record }: Recordable) => {
      return h(Tag, { color: 'default' }, () => record.refundState);
    },
  },
  {
    title: '票务是否注销',
    dataIndex: 'ticketVipcardState',
    width: 150,
  },
  {
    title: '卡种名称',
    dataIndex: 'cardName',
    width: 100,
  },
  {
    title: '所属地区',
    dataIndex: 'airportName',
    width: 140,
  },
  {
    title: '开卡日期',
    dataIndex: 'openCardDate',
    width: 90,
  },
  {
    title: '支付价格',
    dataIndex: 'payAmount',
    width: 80,
  },
  {
    title: '升降级卡种价格',
    dataIndex: 'upgradePayAmount',
    width: 120,
  },
  {
    title: '所属销售',
    dataIndex: 'employeeName',
    width: 100,
  },
  {
    title: '合卡销售',
    dataIndex: 'heKaRemark',
    width: 100,
  },
  {
    title: '会员承担金额',
    dataIndex: 'vipBearAmount',
    width: 120,
  },
  {
    title: '退款银行',
    dataIndex: 'bank',
    width: 120,
  },
  {
    title: '退款卡号',
    dataIndex: 'bankNo',
    width: 120,
  },
  {
    title: '退款方式',
    dataIndex: 'refundWay',
    width: 100,
    dictData: [
      { label: '支付宝', value: 'refund_ali' },
      { label: '微信', value: 'refund_wx' },
      { label: '银行', value: 'refund_bank' },
    ],
    renderType: RenderType.DICT,
  },
  {
    title: '退卡原因',
    dataIndex: 'refundReason',
    width: 250,
  },
  {
    title: '备注说明',
    dataIndex: 'remark',
    width: 250,
  },
  {
    title: '贵宾厅使用明细扣费说明',
    dataIndex: 'remarkc',
    width: 250,
  },
  {
    title: '电子金使用明细扣费说明',
    dataIndex: 'remarkd',
    width: 250,
  },
  {
    title: '补退方式',
    dataIndex: 'addRefundWay',
    width: 100,
    dictData: [
      { label: '支付宝', value: 'refund_ali' },
      { label: '微信', value: 'refund_wx' },
      { label: '银行', value: 'refund_bank' },
    ],
    renderType: RenderType.DICT,
  },
  {
    title: '补退金额',
    dataIndex: 'addRefundAmount',
    width: 120,
  },
  {
    title: '补退备注',
    dataIndex: 'addRefundRemark',
    width: 150,
  },
  {
    title: '标记备注',
    dataIndex: 'tagRemark',
    width: 150,
  },
  {
    title: '提交人',
    dataIndex: 'submitUserName',
    width: 100,
  },
  {
    title: '申请日期',
    dataIndex: 'createDate',
    width: 180,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'userInfo',
    label: '会员信息',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'startDate',
    label: '申请开始日期',
    component: 'DatePicker',
    colProps: { span: 5 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'endDate',
    label: '申请结束日期',
    component: 'DatePicker',
    colProps: { span: 5 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'airportName',
    label: '机场',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'employeeName',
    label: '销售信息',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'refundStateArray',
    label: '审核状态',
    component: 'Select',
    colProps: { span: 4 },
    componentProps: ({ formModel }) => {
      return {
        options: [
          { label: '现办现退成功', value: '现办现退成功' },
          { label: '退款专员已退款', value: '退款专员已退款' },
          { label: '已退', value: '已退' },
        ],
        showSearch: true,
        mode: 'multiple',
        filterOption: (input: string, option: any) => {
          return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
        },
      };
    },
  },
  {
    field: 'openCardStartDate',
    label: '办卡日期起',
    component: 'DatePicker',
    colProps: { span: 5 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'openCardEndDate',
    label: '办卡日期止',
    component: 'DatePicker',
    colProps: { span: 5 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'refundStartDate',
    label: '退款开始日期',
    component: 'DatePicker',
    colProps: { span: 5 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'refundEndDate',
    label: '退款结束日期',
    component: 'DatePicker',
    colProps: { span: 5 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'isHaveFirstUse',
    label: '首次使用',
    component: 'Select',
    colProps: { span: 4 },
    componentProps: ({ formModel }) => {
      return {
        options: [
          { label: '无', value: '0' },
          { label: '有', value: '1' },
        ],
      };
    },
  },
];
